package com.ruoyi.web.controller.vipCard;/**
 * @Title:vipCardController
 * @ClassName: ruoyi
 * @Description: TODO
 * @author: java
 * @time: 2024/3/21 14:21
 */

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.Member;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.member.service.IMemberService;
import com.ruoyi.vipCard.domain.vipCard;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.spring.web.json.Json;

import java.util.List;

/**
 * @ClassName: vipCardController
 * @Description: TODO
 * @author: java
 * @time: 2024/3/21 14:21
 */
@RestController
@RequestMapping("/admin/vipCard")
public class vipCardController extends BaseController {
    @Autowired
    IMemberService memberService;

    @PreAuthorize("@ss.hasPermi('admin:vipCard:getPrice')")
    @GetMapping("/getPrice")
    public vipCard getPrice(){
        return new vipCard();
    }

    @PreAuthorize("@ss.hasPermi('admin:vipCard:editPrice')")
    @PostMapping("/editPrice")
    public AjaxResult editPrice(float newPrice){
        vipCard vipCard=new vipCard();
        vipCard.setPrice(newPrice);
        return AjaxResult.success("会员卡价格已修改为"+new vipCard().getPrice());
    }

    @PreAuthorize("@ss.hasPermi('admin:vipCard:getVipMemberList')")
    @GetMapping("/getVipMemberList")
    public TableDataInfo getVipMemberList(){
        startPage();
        Member member=new Member();
        member.setIsVip("Y");
        List<Member> list=memberService.selectMemberList(member);
        return getDataTable(list);
    }
}
